package cn.wolfcode.luowowo.article.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
public class DestinationCommend extends BaseDomain {

    public static final int HOT_COMMEND = 1;
    public static final int NORMAL_COMMEND = 0;

    private Destination dest;

    private DestinationCommendTheme theme;

    private String coverUrl;

    private Integer month;

    private Integer days;

    private Integer state = NORMAL_COMMEND;

    private Integer sequence = 0;

    private String info;

    public String getJsonString(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        if (dest != null) {
            map.put("destName",dest.getName());
            map.put("destId",dest.getId());
        }
        if (theme != null) {
            map.put("themeName", theme.getName());
            map.put("themeId", theme.getId());
            map.put("themeType", theme.getType());
        }
        map.put("coverUrl", coverUrl);
        map.put("month", month);
        map.put("days", days);
        map.put("state", state);
        map.put("sequence", sequence);
        map.put("info", info);
        return JSON.toJSONString(map);
    }
}